#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;

class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        set<int> se;
        for (auto e : nums) {
            se.insert(e);
        }
        nums.clear();
        for (auto e : se) {
            nums.push_back(e);
        }
        return nums.size();
    }
};


class Solution {
public:
    int removeElement(vector<int>& nums, int val) {
        int posi = 0;
        int posj = nums.size() - 1;
        while (posi <= posj) {
            while (posi <= posj && nums[posi] == val) {
                swap(nums[posi], nums[posj]);
                posj--;
            }
            posi++;
        }
        return posj + 1;
    }
};


class Solution {
public:
    void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
        for (int i = 0; i < n; i++) {
            nums1[i + m] = nums2[i];
        }
        sort(nums1.begin(), nums1.end());
    }
};